package com.sgcc.sx.pmos.common.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.sx.pmos.common.widget.vciv.VerificationCodeInputView;

public class MessageCheckDialog extends Dialog {
    private Context mContext;
    private TextView positiveBn;
    ImageView close_img;
    private VerificationCodeInputView inputView;
    public MessageCheckDialog(@NonNull Context context) {
        super(context, R.style.MesDialog);
        mContext = context;
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));  //圆角起作用
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.messagecheck_dialog_layout);
        //按空白处不能取消动画
        setCanceledOnTouchOutside(false);
        //初始化界面控件
        initView();
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    /**
     * 初始化界面控件
     */
    private void initView() {
        positiveBn = (TextView) findViewById(R.id.positive);
        positiveBn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(onClickListener!=null){
                    onClickListener.onPositiveClick();
                }
            }
        });
        close_img=(ImageView)findViewById(R.id.close_img);
        close_img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MessageCheckDialog.this.dismiss();
            }
        });
//        inputView=(VerificationCodeInputView)findViewById(R.id.vciv_inputCode_code);
//        inputView.setOnInputListener(new VerificationCodeInputView.OnInputListener() {
//            @Override
//            public void onComplete(String code) {
//                if(onClickListener!=null){
//                    onClickListener.onCompleteClick(code);
//                }
//            }
//        });
    }

    public void setOnClickListener(OnClickListener onClickListener) {
        this.onClickListener = onClickListener;
    }
    /**
     * 设置确定取消按钮的回调
     */
    public OnClickListener onClickListener;


    public interface OnClickListener {
        /**
         * 点击确定按钮事件
         */
        public void onPositiveClick();

        /**
         * 点击确定按钮事件
         */
        public void onCompleteClick(String code);

    }


}
